 $(function(){
		 var isOper; //判断是否区分手术或操作
		 var notInCaseNumberStr;//在数据库中无效的病案号
		//点击查询按钮进行病案号检索
		$("#"+tabId+" #aGCaseSearchID").click(function(){   
	 			var medicalRecordNumber=$("#"+tabId+" #abnormalGroupCaseID").val();
	 			if(typeof medicalRecordNumber == "undefined" || medicalRecordNumber == null || medicalRecordNumber == ""){
	 				  drgUI.warning("您没有输入病案号，请重新输入！");
	 			}else{
	 				$.post(contextPath + "/fileUpload/getAbnomalGroupCase.dhc", {
	 					 'medicalRecordNumber': medicalRecordNumber
	 					 }).done(function(res){
	 						//在数据库中无效的病案号，在页面提示
	 						notInCaseNumberStr= res.data.notInCaseNumber;
	 						if(typeof notInCaseNumberStr== "undefined" || notInCaseNumberStr == null || notInCaseNumberStr == ""){
	 			 			}else{
	 			 				 drgUI.warning("您输入的病案号"+notInCaseNumberStr+"在数据库中无记录，请核实！");
	 			 			}
	 						isOper=res.data.isOper; //区分手术或操作
	 						//表格数据填充
	 						data=res.data.abnomalGroupCaseList;
	 						if(typeof data== "undefined" || data == null || data == ""){
	 						}else{
	 							$('#'+tabId+' #aGCase').html('<table class="table nowrap" style="width:100%;"  id="aGCaseTable"'
		 						+'style="text-align: center;"></table>'  );  
	 							if(isOper){
	 								var colunms = [ {"data" : "PMAININDEX" ,title:"索引号"}, 
		 							                {"data" : "MRNUMBER" ,title:"病案号" },
			 										{"data" : "VERCODE" ,title:"分组器版本" },
			 										{"data" : "NEWGROUP" ,title:"入组情况说明(新)"},
			 										{"data" : "OLDGROUP" ,title:"入组情况说明(旧)"},
			 										{"data" : "NEWLOG" ,title:"分组日志(新)"}, 
		 							                {"data" : "OLDLOG" ,title:"分组日志(旧)"},
			 										{"data" : "SEX" ,title:"性别"},
			 										{"data" : "AGE" ,title:"年龄"},
			 										{"data" : "NEWBORNDAY" ,title:"新生儿天数(天)"},
			 										{"data" : "NEWBORNWEIGHT" ,title:"新生儿入院体重(克)" }, 
		 							                {"data" : "VENTIHOUR" ,title:"呼吸机使用时间(小时)"},
			 										{"data" : "INDAYS" ,title:"住院天数" },
			 										{"data" : "COSTAMOUNT" ,title:"总费用"},
			 										{"data" : "LYFS" ,title:"离院方式"},
			 										{"data" : "MDIAGCODE" ,title:"主要诊断ICD"},
			 										{"data" : "MDIAGDESC" ,title:"主要诊断"},
			 										{"data" : "ODIAGAICD" ,title:"其他诊断1ICD"},
			 										{"data" : "ODIAGADESC" ,title:"其他诊断1"},
			 										{"data" : "ODIAGBICD" ,title:"其他诊断2ICD"},
			 										{"data" : "ODIAGBDESC" ,title:"其他诊断2"},
			 										{"data" : "ODIAGCICD" ,title:"其他诊断3ICD"},
			 										{"data" : "ODIAGCDESC" ,title:"其他诊断3"},
			 										{"data" : "ODIAGDICD" ,title:"其他诊断4ICD"},
			 										{"data" : "ODIAGDDESC" ,title:"其他诊断4"},
			 										{"data" : "ODIAGEICD" ,title:"其他诊断5ICD"},
			 										{"data" : "ODIAGEDESC" ,title:"其他诊断5"},
			 										{"data" : "ODIAGFICD" ,title:"其他诊断6ICD"},
			 										{"data" : "ODIAGFDESC" ,title:"其他诊断6"},
			 										{"data" : "ODIAGGICD" ,title:"其他诊断7ICD"},
			 										{"data" : "ODIAGGDESC" ,title:"其他诊断7"},
			 										{"data" : "ODIAGHICD" ,title:"其他诊断8ICD"},
			 										{"data" : "ODIAGHDESC" ,title:"其他诊断8"},
			 										{"data" : "ODIAGIICD" ,title:"其他诊断9ICD"},
			 										{"data" : "ODIAGIDESC" ,title:"其他诊断9"},
			 										{"data" : "ODIAGJICD" ,title:"其他诊断10ICD"},
			 										{"data" : "ODIAGJDESC" ,title:"其他诊断10"},
			 										{"data" : "MOPERCODE" ,title:"主要手术ICD"},
			 										{"data" : "MOPERDESC" ,title:"主要手术"},
													{"data" : "DOPERAICD" ,title:"其他手术1ICD"},
			 										{"data" : "DOPERADESC" ,title:"其他手术1"},
			 										{"data" : "DOPERBICD" ,title:"其他手术2ICD"},
			 										{"data" : "DOPERBDESC" ,title:"其他手术2"},
			 										{"data" : "DOPERCICD" ,title:"其他手术3ICD"},
			 										{"data" : "DOPERCDESC",title:"其他手术3"},
			 										{"data" : "DOPERDICD" ,title:"其他手术4ICD"},
			 										{"data" : "DOPERDDESC" ,title:"其他手术4"},
			 										{"data" : "DOPEREICD" ,title:"其他手术5ICD"},
			 										{"data" : "DOPEREDESC" ,title:"其他手术5"},
			 										{"data" : "DOPERFICD" ,title:"其他手术6ICD"},
			 										{"data" : "DOPERFDESC" ,title:"其他手术6"},
			 										{"data" : "DOPERGICD" ,title:"其他手术7ICD"},
			 										{"data" : "DOPERGDESC" ,title:"其他手术7"},
			 										{"data" : "DOPERHICD" ,title:"其他手术8ICD"},
			 										{"data" : "DOPERHDESC" ,title:"其他手术8"},
			 										{"data" : "DOPERIICD" ,title:"其他手术9ICD"},
			 										{"data" : "DOPERIDESC" ,title:"其他手术9"},
			 										{"data" : "DOPERJICD" ,title:"其他手术10ICD"},
			 										{"data" : "DOPERJDESC" ,title:"其他手术10"},
			 										{"data" : "MHANDLERCODE" ,title:"主要操作ICD"},
			 										{"data" : "MHANDLERDESC" ,title:"主要操作"},
													{"data" : "DHANDLEAICD" ,title:"其他操作1ICD"},
			 										{"data" : "DHANDLEADESC" ,title:"其他操作1"},
			 										{"data" : "DHANDLEBICD" ,title:"其他操作2ICD"},
			 										{"data" : "DHANDLEBDESC" ,title:"其他操作2"},
			 										{"data" : "DHANDLECICD" ,title:"其他操作3ICD"},
			 										{"data" : "DHANDLECDESC",title:"其他操作3"},
			 										{"data" : "DHANDLEDICD" ,title:"其他操作4ICD"},
			 										{"data" : "DHANDLEDDESC" ,title:"其他操作4"},
			 										{"data" : "DHANDLEEICD" ,title:"其他操作5ICD"},
			 										{"data" : "DHANDLEEDESC" ,title:"其他操作5"},
			 										{"data" : "DHANDLEFICD" ,title:"其他操作6ICD"},
			 										{"data" : "DHANDLEFDESC" ,title:"其他操作6"},
			 										{"data" : "DHANDLEGICD" ,title:"其他操作7ICD"},
			 										{"data" : "DHANDLEGDESC" ,title:"其他操作7"},
			 										{"data" : "DHANDLEHICD" ,title:"其他操作8ICD"},
			 										{"data" : "DHANDLEHDESC" ,title:"其他操作8"},
			 										{"data" : "DHANDLEIICD" ,title:"其他操作9ICD"},
			 										{"data" : "DHANDLEIDESC" ,title:"其他操作9"},
			 										{"data" : "DHANDLEJICD" ,title:"其他操作10ICD"},
			 										{"data" : "DHANDLEJDESC" ,title:"其他操作10"}
			 										];
	 							}else{
	 								var colunms = [ {"data" : "PMAININDEX" ,title:"索引号"}, 
		 							                {"data" : "MRNUMBER" ,title:"病案号" },
			 										{"data" : "VERCODE" ,title:"分组器版本" },
			 										{"data" : "NEWGROUP" ,title:"入组情况说明(新)"},
			 										{"data" : "OLDGROUP" ,title:"入组情况说明(旧)"},
			 										{"data" : "NEWLOG" ,title:"分组日志(新)"}, 
		 							                {"data" : "OLDLOG" ,title:"分组日志(旧)"},
			 										{"data" : "SEX" ,title:"性别"},
			 										{"data" : "AGE" ,title:"年龄"},
			 										{"data" : "NEWBORNDAY" ,title:"新生儿天数(天)"},
			 										{"data" : "NEWBORNWEIGHT" ,title:"新生儿入院体重(克)" }, 
		 							                {"data" : "VENTIHOUR" ,title:"呼吸机使用时间(小时)"},
			 										{"data" : "INDAYS" ,title:"住院天数" },
			 										{"data" : "COSTAMOUNT" ,title:"总费用"},
			 										{"data" : "LYFS" ,title:"离院方式"},
			 										{"data" : "MDIAGCODE" ,title:"主要诊断ICD"},
			 										{"data" : "MDIAGDESC" ,title:"主要诊断"},
			 										{"data" : "ODIAGAICD" ,title:"其他诊断1ICD"},
			 										{"data" : "ODIAGADESC" ,title:"其他诊断1"},
			 										{"data" : "ODIAGBICD" ,title:"其他诊断2ICD"},
			 										{"data" : "ODIAGBDESC" ,title:"其他诊断2"},
			 										{"data" : "ODIAGCICD" ,title:"其他诊断3ICD"},
			 										{"data" : "ODIAGCDESC" ,title:"其他诊断3"},
			 										{"data" : "ODIAGDICD" ,title:"其他诊断4ICD"},
			 										{"data" : "ODIAGDDESC" ,title:"其他诊断4"},
			 										{"data" : "ODIAGEICD" ,title:"其他诊断5ICD"},
			 										{"data" : "ODIAGEDESC" ,title:"其他诊断5"},
			 										{"data" : "ODIAGFICD" ,title:"其他诊断6ICD"},
			 										{"data" : "ODIAGFDESC" ,title:"其他诊断6"},
			 										{"data" : "ODIAGGICD" ,title:"其他诊断7ICD"},
			 										{"data" : "ODIAGGDESC" ,title:"其他诊断7"},
			 										{"data" : "ODIAGHICD" ,title:"其他诊断8ICD"},
			 										{"data" : "ODIAGHDESC" ,title:"其他诊断8"},
			 										{"data" : "ODIAGIICD" ,title:"其他诊断9ICD"},
			 										{"data" : "ODIAGIDESC" ,title:"其他诊断9"},
			 										{"data" : "ODIAGJICD" ,title:"其他诊断10ICD"},
			 										{"data" : "ODIAGJDESC" ,title:"其他诊断10"},
			 										{"data" : "MOPERCODE" ,title:"主要手术ICD"},
			 										{"data" : "MOPERDESC" ,title:"主要手术"},
													{"data" : "DOPERAICD" ,title:"其他手术1ICD"},
			 										{"data" : "DOPERADESC" ,title:"其他手术1"},
			 										{"data" : "DOPERBICD" ,title:"其他手术2ICD"},
			 										{"data" : "DOPERBDESC" ,title:"其他手术2"},
			 										{"data" : "DOPERCICD" ,title:"其他手术3ICD"},
			 										{"data" : "DOPERCDESC",title:"其他手术3"},
			 										{"data" : "DOPERDICD" ,title:"其他手术4ICD"},
			 										{"data" : "DOPERDDESC" ,title:"其他手术4"},
			 										{"data" : "DOPEREICD" ,title:"其他手术5ICD"},
			 										{"data" : "DOPEREDESC" ,title:"其他手术5"},
			 										{"data" : "DOPERFICD" ,title:"其他手术6ICD"},
			 										{"data" : "DOPERFDESC" ,title:"其他手术6"},
			 										{"data" : "DOPERGICD" ,title:"其他手术7ICD"},
			 										{"data" : "DOPERGDESC" ,title:"其他手术7"},
			 										{"data" : "DOPERHICD" ,title:"其他手术8ICD"},
			 										{"data" : "DOPERHDESC" ,title:"其他手术8"},
			 										{"data" : "DOPERIICD" ,title:"其他手术9ICD"},
			 										{"data" : "DOPERIDESC" ,title:"其他手术9"},
			 										{"data" : "DOPERJICD" ,title:"其他手术10ICD"},
			 										{"data" : "DOPERJDESC" ,title:"其他手术10"}
			 							];
	 							}
	 							var paramsDataTables={scrollX:true};
	 							if(data.length <=5){
	 								paramsDataTables["scrollY"] = "239px";
	 							}
	 							paramsDataTables["lengthMenu"]=[ [5,10, 25, 50, -1], [5,10, 25, 50, "All"] ];
	 							paramsDataTables["pageLength"]=5;
	 							var myDate = new Date();
	 							var month=parseInt(myDate.getMonth())+1;
	 							if(month<10){
	 								month="0"+month;
	 							}
	 							var date=myDate.getDate();
	 							if(myDate.getDate().length=1){
	 								date="0"+myDate.getDate();
	 							}
	 							paramsDataTables["tableTitle"]=myDate.getFullYear()+month+date+"-XX医院-DRG分组结果有疑义病例数据";
	 							$('#'+tabId+' #aGCaseTable').dataTableBasic(colunms,data,paramsDataTables);
	 						}
	 				}); 
	 			}
	 	});
	 })